package com.akjava.lib.android.opengl.anime;

/*
 * 
 * 
 * 複数に対応できるよう、内部で時間は保持しない
 */
public class AnimeImage {
public int id;
public int frameSize;

public int frameTime;
public int width;
public int height;
public int allImageSize;

public AnimeImage(int id,int allImageSize,int width,int height,int frameTime){
	this.id=id;
	this.allImageSize=allImageSize;
	this.width=width;
	this.height=height;
	this.frameTime=frameTime;
	frameSize=allImageSize/width;
}

/**
 * 
 * @param rect
 * @param time
 * @return
 * 
 * 
 */
public int[] getRectInt(int[] rect,long time){
	long mod=time%(frameTime*frameSize);

	int index=(int) (mod/frameTime);
	
	rect[0]=width*index;
	rect[1]=0;
	rect[2]=width;
	rect[3]=height;
	return rect;
}

}
